<?php
//=========================<script réaliser par :Ditini ANASS>===================
	include_once('config.php');
	include_once('Connect_pdo.php');
	extract($_GET);
	$return ="";
	if($action=="get"){
		$query = $con->prepare("select r.*, n.nom as nom, n.prenom as prenom from reclamation r, nomade n where etat=0 AND n.idNomade=r.idNomade;");
		$ids;
		$i=0;
		if($query->execute()){
			$count = $query->rowCount();
			$query->setFetchMode(PDO::FETCH_OBJ);
			if($count > 0){
				while($reclamation = $query->fetch()){
					$return[] = array(
						"idReclamation"=> $reclamation->idReclamation,
						"designationTache"=> $reclamation->designationTache,
						"description"=> $reclamation->description,
						"dateReclamation"=> $reclamation->dateReclamation,
						"etat" => $reclamation->etat,
						"idNomade" => $reclamation->idNomade,
						"nom" => $reclamation->nom,
						"prenom" => $reclamation->prenom
						);
					$i++;
				}
				$sql = "UPDATE reclamation 
				SET etat=-1
				WHERE etat=0";
				$q = $con->prepare($sql);
				$q->execute();
			}
		}
		echo json_encode($return);
	}